
import React from 'react'
import { Typography, List, Checkbox } from 'antd'
import useGetCategories from '../../helpers/getCatgories'

const { Title } = Typography
 
function FilterByCatgory({handleFilter}) {
  const categories = useGetCategories()
  // console.log(categories)
  const onChange = (checkedValue) => {handleFilter(checkedValue)}
 
   return (
      <>
        <Title level={5}>按照分类筛选</Title>
        <Checkbox.Group onChange={onChange}>
          <List
           dataSource={categories}
           renderItem={item => (
            <List.Item>
              <Checkbox value={item._id}>{item.name}</Checkbox>
            </List.Item>
           )}
          />
        </Checkbox.Group>
      </>
   )
 }
 
 export default FilterByCatgory
 


